using System;
using System.Diagnostics.Contracts;
using System.IO;

namespace OpenCube.Nbt
{
	/// <summary>
	/// Thrown when there is a format exception in a NBT stream that is being read.
	/// </summary>
	[Pure]
	public class NbtFileFormatException
		: IOException
	{
		public NbtFileFormatException()
			: base()
		{
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="NbtFileFormatException" /> class.
		/// </summary>
		/// <param name="message">The message of the exception.</param>
		public NbtFileFormatException(string message)
			: base(message)
		{
			Contract.Requires<ArgumentNullException>(!string.IsNullOrEmpty(message));
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="NbtFileFormatException" /> class.
		/// </summary>
		/// <param name="message">The message of the exception.</param>
		/// <param name="innerException">The [optional] inner exception that was catched, resulting in this new exception.</param>
		public NbtFileFormatException(string message, Exception innerException)
			: base(message, innerException)
		{
			Contract.Requires<ArgumentNullException>(!string.IsNullOrEmpty(message));
		}
	}
}